﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:Prototypes="clr-namespace:CI.UI.Prototypes" 
                    xmlns:Production="clr-namespace:CI.Models.Production;assembly=CI.Models" 
                    xmlns:Converters="clr-namespace:GraphSharp.Converters;assembly=GraphSharp.Controls" 
                    xmlns:Controls="clr-namespace:GraphSharp.Controls;assembly=GraphSharp.Controls" 
                    xmlns:WPFExtensions_AttachedBehaviours="clr-namespace:WPFExtensions.AttachedBehaviours;assembly=WPFExtensions" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:Models="clr-namespace:CI.Models;assembly=CI.Models" xmlns:Data="clr-namespace:CI.Models.Data;assembly=CI.Models" mc:Ignorable="d">

    <LinearGradientBrush x:Key="PILevel.Resource" EndPoint="0.5,1" StartPoint="0.5,0">
        <GradientStop Color="#FF003FFF" Offset="1"/>
        <GradientStop Color="#FF37AFF9" Offset="0"/>
    </LinearGradientBrush>
    <LinearGradientBrush x:Key="PILevel.Tier1" EndPoint="0.5,1" StartPoint="0.5,0">
        <GradientStop Color="#FFA5072E" Offset="1"/>
        <GradientStop Color="#FFF92F4B" Offset="0"/>
    </LinearGradientBrush>
    <LinearGradientBrush x:Key="PILevel.Tier2" EndPoint="0.5,1" StartPoint="0.5,0">
        <GradientStop Color="#FFE3E6F5" Offset="0"/>
        <GradientStop Color="#FF9D9D9D" Offset="1"/>
    </LinearGradientBrush>
    <LinearGradientBrush x:Key="PILevel.Tier3" EndPoint="0.5,1" StartPoint="0.5,0">
        <GradientStop Color="#FF82B03C" Offset="1"/>
        <GradientStop Color="#FFD8FA6C" Offset="0"/>
    </LinearGradientBrush>
    <LinearGradientBrush x:Key="PILevel.Tier4" EndPoint="0.5,1" StartPoint="0.5,0">
        <GradientStop Color="#FF753CB0" Offset="1"/>
        <GradientStop Color="#FF6C88FA" Offset="0"/>
    </LinearGradientBrush>
    <LinearGradientBrush x:Key="ProductionJobBorderBrush" EndPoint="0.5,1" StartPoint="0.49,0">
        <GradientStop Color="#FF939393" Offset="0.108"/>
        <GradientStop Color="#FF0A0A0A" Offset="0"/>
        <GradientStop Color="Black" Offset="1"/>
        <GradientStop Color="#FF1D1D1D" Offset="0.176"/>
    </LinearGradientBrush>
    
    <Prototypes:EveIconConverter x:Key="EveIconConverter"/>
            <Prototypes:PILevelBackgroundColorConverter x:Key="PILevelBackgroundColorConverter"/>

    <DataTemplate DataType="{x:Type Models:Owner}">
        <Grid>
            <Grid.RowDefinitions>
                <RowDefinition/>
            </Grid.RowDefinitions>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="Auto"/>
                <ColumnDefinition Width="Auto"/>
            </Grid.ColumnDefinitions>
            <TextBlock Grid.Row="0" Grid.Column="1" FontSize="72" FontWeight="DemiBold" Text="{Binding Path=Name}"/>
        </Grid>
    </DataTemplate>
    <DataTemplate DataType="{x:Type Data:Region}">
        <Grid>
            <Grid.RowDefinitions>
                <RowDefinition/>
            </Grid.RowDefinitions>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="Auto"/>
                <ColumnDefinition Width="Auto"/>
            </Grid.ColumnDefinitions>
            <TextBlock Grid.Row="0" Grid.Column="1" FontSize="72" FontWeight="DemiBold" Text="{Binding Path=regionName}"/>
        </Grid>
    </DataTemplate>


    <!--Background by type, find mid sized imagery for production, combat, trade, transport, pos maintenance!?, research etc-->
            <DataTemplate DataType="{x:Type Production:PIProductionJob}">
                <Grid  >
                    <Grid.RowDefinitions>
                    	<RowDefinition Height="10"/>
                    	<RowDefinition Height="Auto"/>
                    	<RowDefinition Height="Auto"/>
                    	<RowDefinition Height="10"/>
						<RowDefinition Height="Auto"/>
						<RowDefinition Height="10"/>
                    </Grid.RowDefinitions>
                    <Grid.ColumnDefinitions>
                    	<ColumnDefinition Width="10"/>
                    	<ColumnDefinition Width="Auto"/>
                    	<ColumnDefinition Width="10"/>
                    	<ColumnDefinition Width="Auto"/>
                    	<ColumnDefinition Width="10"/>
                    </Grid.ColumnDefinitions>
            <Grid Grid.Row="1" Grid.Column="1" Grid.ColumnSpan="3">
            	<Grid.ColumnDefinitions>
            		<ColumnDefinition Width="Auto"/>
            		<ColumnDefinition/>
            	</Grid.ColumnDefinitions>
                    
                		<Image Grid.Row="0" Grid.Column="0" Source="imagery/jobTypes/production.png" />
                		<Rectangle Grid.Row="0" Grid.Column="1" Fill="{Binding ManufacturingLevel, Converter={StaticResource PILevelBackgroundColorConverter}}"/>
						<TextBlock Margin="4,2,2,2" Text="{Binding Output.Item.TypeName}" FontSize="24" FontWeight="Black" Grid.Row="0" Grid.Column="1" TextWrapping="WrapWithOverflow" />
                	</Grid>
                	
                    
                	<Grid Width="200" Grid.Row="2" Grid.Column="1" Height="119.803333333333">
                		<Grid.RowDefinitions>
                			<RowDefinition />
                			<RowDefinition />
                			<RowDefinition />
                			<RowDefinition />
                			<RowDefinition />
                		</Grid.RowDefinitions>
                		<Grid.ColumnDefinitions>
                			<ColumnDefinition Width="Auto"/>
                			<ColumnDefinition Width="*"/>
                		</Grid.ColumnDefinitions>
                		<TextBlock VerticalAlignment="Center" Grid.Row="1" Grid.Column="0" TextAlignment="Right" Margin="0,0,10,0"><Run Text="Runs"/></TextBlock>
                		<TextBox Text="{Binding Runs}" Grid.Row="1" Grid.Column="1" Margin="2"/>
                		<TextBlock VerticalAlignment="Center" Grid.Row="2" Grid.Column="0" TextAlignment="Right" Margin="0,0,10,0"><Run Text="Quantity Per Run"/></TextBlock>
                		<TextBox Text="{Binding Output.Quantity.PerRun}" Grid.Row="2" Grid.Column="1" IsReadOnlyCaretVisible="false" IsReadOnly="{Binding Output.Quantity.IsPerRunEdittable}" Margin="2"/>
                		<TextBlock VerticalAlignment="Center" Grid.Row="3" Grid.Column="0" TextAlignment="Right" Margin="0,0,10,0"><Run Text="Total Quantity"/></TextBlock>
                		<TextBox Text="{Binding Output.Quantity.Total}" Grid.Row="3" Grid.Column="1" Margin="2"/>
                	</Grid>
                	<Grid Grid.Column="3" HorizontalAlignment="Stretch" Margin="0" Grid.RowSpan="1" Width="200" Grid.Row="2"/>
                	<Expander Header="Materials" d:LayoutOverrides="Width, Height" Grid.Row="4" Grid.Column="1" Grid.ColumnSpan="3">
                		<Grid Background="#FFE5E5E5">
                			<DataGrid HorizontalAlignment="Left" d:LayoutOverrides="Height" AutoGenerateColumns="False" ItemsSource="{Binding Materials}">
                				<DataGrid.Columns>
                					<DataGridTextColumn Width="198" Binding="{Binding Item.TypeName}" Header="Item"/>
                					<DataGridTextColumn Width="100" Binding="{Binding Quantity.PerRun}" Header="Per Run"/>
                					<DataGridTextColumn Width="100" Binding="{Binding Quantity.Total}" Header="Total"/>
                				</DataGrid.Columns>
                			</DataGrid>
                		</Grid>
                	</Expander>
                </Grid>
            </DataTemplate>
    
</ResourceDictionary>